<?php
namespace app\index\model;

use think\Model;

class Comment extends Model
{
    protected $table = 'sn_comment';

    //关联短视频表
    public function video()
    {
        return $this->belongsTo('Video', 'video_id', 'id');
    }
    //关联用户表
    public function user()
    {
        return $this->belongsTo('User', 'userid', 'id');
    }
    public function user1()
    {
        return $this->belongsTo('User', 'parent_id', 'id');
    }
    /**
     * @param $map
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function query_list($map)
    {
        return $this->relation(array('video','user'))->where($map)->paginate();
    }
}